/*global _ctxPath*/
import { useBaseInfoWithOut } from '@/store/modules/base-info';
import globalData from '@/plugins/data';
import globalMethods from '@/plugins/methods';

function fileDiffHistory() {
  const historyDialog = globalMethods.dialog({
    id: 'historyDialog',
    title: $.i18n('intelli.doc.comparison.historyRecord'),
    url: _ctxPath + '/doc/docComparisonFront.do?method=historyList',
    width: 1095,
    bodyStyle:'padding:0',
    centered: true,
    height:  window.top.innerHeight * 0.8,
    targetWindow: window,
    transParams: {
      summaryId: globalData.summaryId,
      formId: useBaseInfoWithOut().businessData?.template?.formAppId
    },
    cancelText: $.i18n('intelli.doc.comparison.historyRecord.cancel'),
    okText: $.i18n('intelli.doc.comparison.historyRecord.confirm'),
    onCancel() {
      historyDialog.close();
    },
    onConfirm() {
      historyDialog.close();
    }
  });

  // 临时代码，待 all-min 修复好后删除
  top.transParamsHelper.get = function () {
    return {
      summaryId: globalData.summaryId,
      formId: useBaseInfoWithOut().businessData?.template?.formAppId
    };
  };
}

export default function () {
  return new Promise((resolve) => {
    fileDiffHistory.call(this);
    resolve();
  });
}
